home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / gnome-vfs-2.0 / libgnomevfs / gnome-vfs-standard-callbacks.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-05-01  |  11.3 KB  |  347 lines

  1. /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
  2. /*
  3.  
  4.    Copyright (C) 2001 Eazel, Inc
  5.    Copyright (C) 2002 Seth Nickell
  6.  
  7.    The Gnome Library is free software; you can redistribute it and/or
  8.    modify it under the terms of the GNU Library General Public License as
  9.    published by the Free Software Foundation; either version 2 of the
  10.    License, or (at your option) any later version.
  11.  
  12.    The Gnome Library is distributed in the hope that it will be useful,
  13.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.    Library General Public License for more details.
  16.  
  17.    You should have received a copy of the GNU Library General Public
  18.    License along with the Gnome Library; see the file COPYING.LIB.  If not,
  19.    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20.    Boston, MA 02111-1307, USA.
  21.  
  22.    Author: Michael Fleming <mfleming@eazel.com>
  23.            Seth Nickell <snickell@stanford.edu>
  24. */
  25.  
  26. #ifndef GNOME_VFS_STANDARD_CALLBACKS_H
  27. #define GNOME_VFS_STANDARD_CALLBACKS_H
  28.  
  29. #include <glib/gtypes.h>
  30. #include <libgnomevfs/gnome-vfs-uri.h>
  31.  
  32. G_BEGIN_DECLS
  33.  
  34. /*
  35.  * defined callback structures
  36.  */
  37.  
  38. /*
  39.  * hook name: "full-authentication"
  40.  * In arg: GnomeVFSModuleCallbackFullAuthenticationIn *
  41.  * Out arg: GnomeVFSModuleCallbackFullAuthenticationOut *
  42.  * 
  43.  * Called when access to a URI requires a username/password etc.
  44.  */
  45. #define GNOME_VFS_MODULE_CALLBACK_FULL_AUTHENTICATION "full-authentication"
  46.  
  47. /*
  48.  * hook name: "pre-authentication"
  49.  * In arg: GnomeVFSModuleCallbackFillAuthenticationIn *
  50.  * Out arg: GnomeVFSModuleCallbackFillAuthenticationOut *
  51.  * 
  52.  * Called to get cached or stored user/password etc data to fill
  53.  * a request. Should not cause prompting to the user 
  54.  */
  55. #define GNOME_VFS_MODULE_CALLBACK_FILL_AUTHENTICATION "fill-authentication"
  56.  
  57. /*
  58.  * hook name: "post-authentication"
  59.  * In arg: GnomeVFSModuleCallbackSaveAuthenticationIn *
  60.  * Out arg: GnomeVFSModuleCallbackSaveAuthenticationOut *
  61.  * 
  62.  * Called after a successfull authentication, to allow the client to e.g.
  63.  * store the password for future use.
  64.  */
  65. #define GNOME_VFS_MODULE_CALLBACK_SAVE_AUTHENTICATION "save-authentication"
  66.  
  67. /*
  68.  * hook name: "simple-authentication"
  69.  * In arg: GnomeVFSModuleCallbackAuthenticationIn *
  70.  * Out arg: GnomeVFSModuleCallbacAuthenticationOut *
  71.  * 
  72.  * Called when access to a URI requires a username/password
  73.  * Deprecated in favour of full-authentication
  74.  */
  75. #define GNOME_VFS_MODULE_CALLBACK_AUTHENTICATION "simple-authentication"
  76.  
  77. /*
  78.  * hook name: "http:proxy-authentication"
  79.  * In arg: GnomeVFSModuleCallbackAuthenticationIn *
  80.  * Out arg: GnomeVFSModuleCallbackAuthenticationOut *
  81.  * 
  82.  * Called when access to an HTTP proxy requires a username/password
  83.  */
  84. #define GNOME_VFS_MODULE_CALLBACK_HTTP_PROXY_AUTHENTICATION "http:proxy-authentication"
  85.  
  86. /*
  87.  * hook name: "ask-question"
  88.  * In arg: GnomeVFSModuleCallbackQuestionIn *
  89.  * Out arg: GnomeVFSModuleCallbackQuestionOut *
  90.  * 
  91.  * Called when access to a URI requires the user to make a choise
  92.  */
  93. #define GNOME_VFS_MODULE_CALLBACK_QUESTION "ask-question"
  94.  
  95. typedef struct {
  96.     char *uri;        /* Full URI of operation */
  97.     char *protocol;         /* The protocol of the request */
  98.     char *server;           /* The server of the request */
  99.     char *object;           /* object on the server, smb share, http realm, etc */
  100.     int port;               /* network port of the request (0 means unset) */
  101.     char *authtype;         /* authentication type (protocol specific) */
  102.     char *username;
  103.     char *domain;           /* e.g for smb nt domains */
  104.  
  105.     /* Reserved "padding" to avoid future breaks in ABI compatibility */
  106.     void *reserved1;
  107.     void *reserved2;
  108. } GnomeVFSModuleCallbackFillAuthenticationIn;
  109.  
  110. typedef struct {
  111.     gboolean valid;         /* set to TRUE if the rest of the data is valid */
  112.     char *username;        /* will be freed by g_free */
  113.     char *domain;        /* will be freed by g_free */
  114.     char *password;        /* will be freed by g_free */
  115.  
  116.     /* Reserved "padding" to avoid future breaks in ABI compatibility */
  117.     void *reserved1;
  118.     void *reserved2;
  119. } GnomeVFSModuleCallbackFillAuthenticationOut;
  120.  
  121. typedef enum {
  122.     GNOME_VFS_MODULE_CALLBACK_FULL_AUTHENTICATION_PREVIOUS_ATTEMPT_FAILED = 1<<0,
  123.     GNOME_VFS_MODULE_CALLBACK_FULL_AUTHENTICATION_NEED_PASSWORD = 1<<1,
  124.     GNOME_VFS_MODULE_CALLBACK_FULL_AUTHENTICATION_NEED_USERNAME = 1<<2,
  125.     GNOME_VFS_MODULE_CALLBACK_FULL_AUTHENTICATION_NEED_DOMAIN = 1<<3,
  126.     GNOME_VFS_MODULE_CALLBACK_FULL_AUTHENTICATION_SAVING_SUPPORTED = 1<<4,
  127.     GNOME_VFS_MODULE_CALLBACK_FULL_AUTHENTICATION_ANON_SUPPORTED = 1<<5
  128. } GnomeVFSModuleCallbackFullAuthenticationFlags;
  129.  
  130. typedef struct {
  131.     GnomeVFSModuleCallbackFullAuthenticationFlags flags;          /* GnomeVFSModuleCallbackFullAuthenticationFlags mask */
  132.     char *uri;        /* Full URI of operation */
  133.     char *protocol;         /* The protocol of the request */
  134.     char *server;           /* The server of the request */
  135.     char *object;           /* object on the server, smb share, http realm, etc */
  136.     int port;               /* network port of the request (0 means unset) */
  137.     char *authtype;         /* authentication type (protocol specific) */
  138.     char *username;
  139.     char *domain;           /* e.g for smb nt domains */
  140.  
  141.     /* for pre-filling the dialog */
  142.     char *default_user;     
  143.     char *default_domain;
  144.     
  145.     /* Reserved "padding" to avoid future breaks in ABI compatibility */
  146.     void *reserved1;
  147.     void *reserved2;
  148. } GnomeVFSModuleCallbackFullAuthenticationIn;
  149.  
  150. typedef enum {
  151.     GNOME_VFS_MODULE_CALLBACK_FULL_AUTHENTICATION_OUT_ANON_SELECTED = 1<<0
  152. } GnomeVFSModuleCallbackFullAuthenticationOutFlags;
  153.  
  154. typedef struct {
  155.     gboolean abort_auth;    /* set to TRUE if the user cancelled */
  156.     char *username;        /* will be freed by g_free */
  157.     char *domain;        /* will be freed by g_free */
  158.     char *password;        /* will be freed by g_free */
  159.  
  160.     gboolean save_password;
  161.     char *keyring;
  162.  
  163.     gsize out_flags; /* really a GnomeVFSModuleCallbackFullAuthenticationOutFlags*/
  164.     
  165.     /* Reserved "padding" to avoid future breaks in ABI compatibility */
  166.     void *reserved2;
  167. } GnomeVFSModuleCallbackFullAuthenticationOut;
  168.  
  169.  
  170. typedef struct {
  171.     char *keyring;          /* keyring to save on */
  172.     
  173.     char *uri;        /* Full URI of operation */
  174.     char *protocol;         /* The protocol of the request */
  175.     char *server;           /* The server of the request */
  176.     char *object;           /* object on the server, smb share, http realm, etc */
  177.     int port;               /* network port of the request (0 means unset) */
  178.     char *authtype;         /* authentication type (protocol specific) */
  179.     char *username;
  180.     char *domain;           /* e.g for smb nt domains */
  181.     char *password;
  182.  
  183.     /* Reserved "padding" to avoid future breaks in ABI compatibility */
  184.     void *reserved1;
  185.     void *reserved2;
  186. } GnomeVFSModuleCallbackSaveAuthenticationIn;
  187.  
  188. typedef struct {
  189.     /* Reserved "padding" to avoid future breaks in ABI compatibility */
  190.     void *reserved1;
  191.     void *reserved2;
  192. } GnomeVFSModuleCallbackSaveAuthenticationOut;
  193.  
  194. typedef struct {
  195.     char *uri;        /* Full URI of operation */
  196.     char *realm;        /* for HTTP auth, NULL for others */
  197.     gboolean previous_attempt_failed;
  198.                 /* TRUE if there were credentials specified
  199.                  * for this request, but they resulted in
  200.                  * an authorization error. 
  201.                  * ("you gave me the wrong pw!")
  202.                  * 
  203.                  * FALSE if there were no credentials specified
  204.                  * but they are required to continue
  205.                  * 
  206.                  */
  207.     enum {
  208.         AuthTypeBasic,    /* Password will be transmitted unencrypted */
  209.         AuthTypeDigest    /* Digest is transferred, not plaintext credentials */        
  210.     } auth_type;
  211.  
  212.     /* Reserved "padding" to avoid future breaks in ABI compatibility */
  213.     void *reserved1;
  214.     void *reserved2;
  215.  
  216. } GnomeVFSModuleCallbackAuthenticationIn;
  217.  
  218. typedef struct {
  219.     char *username;        /* will be freed by g_free,
  220.                  * NULL indicates no auth should be provided;
  221.                  * if the request requires authn, the operation
  222.                  * will fail with a GNOME_VFS_ERROR_ACCESS_DENIED
  223.                  * code
  224.                  */
  225.     char *password;        /* will be freed by g_free */
  226.  
  227.     /* Reserved "padding" to avoid future breaks in ABI compatibility */
  228.     void *reserved1;
  229.     void *reserved2;
  230.  
  231. } GnomeVFSModuleCallbackAuthenticationOut;
  232.  
  233. /*
  234.  * hook name: "http:send-additional-headers"
  235.  * In arg: GnomeVFSModuleCallbackAdditionalHeadersIn *
  236.  * Out arg: GnomeVFSModuleCallbackAdditionalHeadersOut *
  237.  *
  238.  * Called before sending headers to an HTTP server.
  239.  */
  240.  
  241. #define GNOME_VFS_MODULE_CALLBACK_HTTP_SEND_ADDITIONAL_HEADERS "http:send-additional-headers"
  242.  
  243. typedef struct {
  244.     GnomeVFSURI *uri;        /* URI of operation */
  245.  
  246.     /* Reserved "padding" to avoid future breaks in ABI compatibility */
  247.     void *reserved1;
  248.     void *reserved2;
  249. } GnomeVFSModuleCallbackAdditionalHeadersIn;
  250.  
  251. typedef struct {
  252.     GList *headers;            /* list of headers, will be freeed */
  253.  
  254.     /* Reserved "padding" to avoid future breaks in ABI compatibility */
  255.     void *reserved1;
  256.     void *reserved2;
  257. } GnomeVFSModuleCallbackAdditionalHeadersOut;
  258.  
  259. /*
  260.  * hook name: "http:received-headers"
  261.  * In arg: GnomeVFSModuleCallbackReceivedHeadersIn *
  262.  * Out arg: GnomeVFSModuleCallbackReceivedHeadersOut *
  263.  *
  264.  * Called after receiving the HTTP headers from the server.
  265.  */
  266.  
  267. #define GNOME_VFS_MODULE_CALLBACK_HTTP_RECEIVED_HEADERS "http:received-headers"
  268.  
  269. typedef struct {
  270.     GnomeVFSURI *uri;        /* URI of operation */
  271.     GList *headers;            /* list of headers */
  272.  
  273.     /* Reserved "padding" to avoid future breaks in ABI compatibility */
  274.     void *reserved1;
  275.     void *reserved2;
  276. } GnomeVFSModuleCallbackReceivedHeadersIn;
  277.  
  278. typedef struct {
  279.     int dummy;
  280.  
  281.     /* Reserved "padding" to avoid future breaks in ABI compatibility */
  282.     void *reserved1;
  283.     void *reserved2;
  284. } GnomeVFSModuleCallbackReceivedHeadersOut;
  285.  
  286. /*
  287.  * hook name: "status-message"
  288.  * In arg: GnomeVFSModuleCallbackStatusMessageIn *
  289.  * Out arg: GnomeVFSModuleCallbackStatusMessageOut *
  290.  * 
  291.  * Called when a GnomeVFS API or module has a status message to return to
  292.  * the user.
  293.  */
  294.  
  295. #define GNOME_VFS_MODULE_CALLBACK_STATUS_MESSAGE "status-message"
  296.  
  297. typedef struct {
  298.     char *uri;        /* Full URI of operation */
  299.     char *message;        /* A message indicating the current state or
  300.                  * NULL if there is no message */
  301.     int percentage;        /* Percentage indicating completeness 0-100 or
  302.                  * -1 if there is no progress percentage to
  303.                  * report */
  304.  
  305.     /* Reserved "padding" to avoid future breaks in ABI compatibility */
  306.     void *reserved1;
  307.     void *reserved2;
  308. } GnomeVFSModuleCallbackStatusMessageIn;
  309.  
  310. typedef struct {
  311.     int dummy; /* empty structs not allowed */
  312.  
  313.     /* Reserved "padding" to avoid future breaks in ABI compatibility */
  314.     void *reserved1;
  315.     void *reserved2;
  316. } GnomeVFSModuleCallbackStatusMessageOut;
  317.  
  318. typedef struct {
  319.     char *primary_message;      /* A short message explaining the question to 
  320.                    * the user or NULL if there is no message
  321.                    */
  322.     char *secondary_message;  /* The long version of the message, containing
  323.                    * more details. Or Null if there is no message
  324.                    */
  325.     char **choices;          /* NULL terminated list of choices the user have to choose from.
  326.                    * The first item in the list should be affermative, and
  327.                    * will be put on the right in a GUI dialog.
  328.                    */
  329.     
  330.     /* Reserved "padding" to avoid future breaks in ABI compatibility */
  331.     void *reserved1;
  332.     void *reserved2;
  333. } GnomeVFSModuleCallbackQuestionIn;
  334.  
  335. typedef struct {
  336.     int answer; /* The index of the choice in the choices list sent in 
  337.                to the callback */
  338.  
  339.     /* Reserved "padding" to avoid future breaks in ABI compatibility */
  340.     void *reserved1;
  341.     void *reserved2;
  342. } GnomeVFSModuleCallbackQuestionOut;
  343.  
  344. G_END_DECLS
  345.  
  346. #endif /* GNOME_VFS_STANDARD_CALLBACKS_H */
  347.